FROM php:7.4-fpm

# 添加用户
ARG php_user=flowerwow
RUN groupadd -g 1000 ${php_user}
RUN useradd -u 1000 -g ${php_user} ${php_user}

# 第三方安装php库的脚本
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# 使其可执行
RUN chmod +x /usr/local/bin/install-php-extensions

# 更新依赖
RUN apt update && apt install supervisor procps vim -y

# 安装php扩展
RUN pecl install uploadprogress && docker-php-ext-enable uploadprogress 

# 拓展拆分为步骤安装 防止哪一步不成功
RUN install-php-extensions bcmath
RUN install-php-extensions bz2
RUN install-php-extensions calendar
RUN install-php-extensions curl
RUN install-php-extensions exif
RUN install-php-extensions fileinfo
RUN install-php-extensions ftp
RUN install-php-extensions gd
RUN install-php-extensions gettext
RUN install-php-extensions imagick
RUN install-php-extensions imap
RUN install-php-extensions intl
RUN install-php-extensions ldap
RUN install-php-extensions mbstring
RUN install-php-extensions mcrypt
RUN install-php-extensions mongodb
RUN install-php-extensions mysqli
RUN install-php-extensions opcache
RUN install-php-extensions openssl
RUN install-php-extensions pdo
RUN install-php-extensions pdo_mysql
RUN install-php-extensions redis
RUN install-php-extensions soap
RUN install-php-extensions sodium
RUN install-php-extensions sysvsem
RUN install-php-extensions sysvshm
RUN install-php-extensions xmlrpc
RUN install-php-extensions xsl
RUN install-php-extensions xlswriter
RUN install-php-extensions zip

# 安装composer
RUN php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" \
    && php composer-setup.php \
    && php -r "unlink('composer-setup.php');" \
    && mv composer.phar /usr/local/bin/composer \
    && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

# 工作目录
WORKDIR /www